<?php
/**
 * @version SVN: $Id: default.php 1174 2010-04-26 14:51:33Z elkuku $
 * @package    EasyCreator
 * @subpackage Views
 * @author     EasyJoomla {@link http://www.easy-joomla.org Easy-Joomla.org}
 * @author     Nikolai Plath {@link http://www.nik-it.de}
 * @author     Created on 12-Oct-2009
 * @license    GNU/GPL, see JROOT/LICENSE.php
 */

//--No direct access
defined('_JEXEC') or die('=;)');

$groups = $this->parameters->getGroups();
$blacks = array('_default', 'personal');

?>
<div class="ecr_easy_toolbar" style="float: right;">
    <ul>
        <li>
            <a href="javascript:;" onclick="submitform('save_config');">
                <span class="icon-32-save" title="<?php echo JText::_('Save'); ?>"></span>
                <?php echo JText::_('Save'); ?>
            </a>
        </li>
    </ul>
</div>

<div align="center">
    <strong style="font-size: 1.5em;">EasyCreator</strong>
    <h1><?php echo JText::_('Configuration'); ?></h1>
</div>

<div style="clear: both;"></div>

<div class="ecr_floatbox" style="background-color: #ffc;">
    <?php ecrHTML::boxStart(); ?>
    <div class="imgbar icon-24-identity"></div>
    <?php
    echo formatMy16Params($this->parameters, 'personal');
    ecrHTML::boxEnd();
?>
</div>

<?php
foreach (array_keys($groups) as $group):
    if( in_array($group, $blacks)):
        continue;
    endif;
    $style = str_replace(' ', '_', strtolower($group));
    ecrHTML::floatBoxStart(); ?>
		<div class="imgbar icon-24-<?php echo $style; ?>"></div>

    	<div class="table_name"><?php echo JText::_($group); ?></div>
        <?php
        echo formatMy16Params($this->parameters, $group);
    ecrHTML::floatBoxEnd();
endforeach;

if(ECR_DEV_MODE): ?>
    <div class="ecr_floatbox">
    <?php ecrHTML::boxStart(); ?>
    	<div class="imgbar icon-24-bug"></div>
        <?php echo formatMy16Params($this->parameters, '_default'); ?>
    <?php ecrHTML::boxEnd(); ?>
    </div>
<?php endif; ?>

<div style="clear: both;"></div>

<?php
function formatMy16Params($parameters, $groupName)
{
	$html = $parameters->render('params', $groupName);
	$html = explode(PHP_EOL, $html);

	for($i = 0; $i < count($html) - 1; $i++)
	{
		if(strpos($html[$i], '<label') === 0)
		{
		  $html[$i] = BR.BR.$html[$i];
		  continue;
		}
	}//for

	return implode("\n", $html);
}//function
